//
//  LBDakaCell.m
//  V-Learn
//
//  Created by Apple on 2019/1/2.
//  Copyright © 2019 yxk. All rights reserved.
//

#import "LBDakaCell.h"

@implementation LBDakaCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        [self setupUI];
    }
    return self;
}
+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *identifferCell = @"LBDakaCell";
    LBDakaCell *cell = [tableView dequeueReusableCellWithIdentifier:identifferCell];
    if (!cell) {
        cell = [[LBDakaCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifferCell];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        
    }
    return cell;
}
- (void)setupUI{
    
    UIView *bgView = [UIView new];
    
    [self.contentView addSubview:bgView];
    bgView.backgroundColor = [UIColor whiteColor];
    [bgView makeConstraints:^(MASConstraintMaker *make) {
            make.left.top.right.mas_equalTo(0);
            make.height.mas_equalTo(80*kScaleFit);
        }];
    
    self.icon = [[UIImageView alloc] init];
    self.icon.image = [UIImage imageNamed:@"wk_list_bgimg"];
    self.icon.layer.cornerRadius = 22.5;
    self.icon.layer.masksToBounds = YES;
    
    [bgView addSubview:self.icon];
    [self.icon makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15*kScaleFit);
        make.centerY.mas_equalTo(bgView);
        make.size.mas_equalTo(CGSizeMake(45*kScaleFit, 45*kScaleFit));
    }];
    
    self.nickLab = [UILabel labelWithText:@"何以繁华笙歌落" andTextColor:rgb(51,51,51) andName:nil andFontSize:15*kScaleFit];
    [bgView addSubview:self.nickLab];
    [self.nickLab makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.icon.mas_right).mas_equalTo(10*kScaleFit);
        make.top.mas_equalTo(self.icon.mas_top);
        make.right.mas_equalTo(-40*kScaleFit);
    }];
    
    self.timeLab = [UILabel labelWithText:@"18:09" andTextColor:rgb(102,102,102) andName:nil andFontSize:12*kScaleFit];
    [bgView addSubview:self.timeLab];
    [self.timeLab makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.icon.mas_right).mas_equalTo(10*kScaleFit);
        make.top.mas_equalTo(self.nickLab.mas_bottom).mas_equalTo(10*kScaleFit);
        make.right.mas_equalTo(-40*kScaleFit);
    }];
    
    
    
    self.titleLab = [UILabel labelWithText:@"万思乐学 小西妈双语工程 20180725008  耿思悦201503 北京 28次 20181026" andTextColor:rgb(51,51,51) andName:nil andFontSize:14*kScaleFit];
    self.titleLab.numberOfLines = 2;
    [self.contentView addSubview:self.titleLab];
    [self.titleLab makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15*kScaleFit);
        make.top.mas_equalTo(bgView.mas_bottom);
        make.right.mas_equalTo(-30*kScaleFit);
    }];
    
    self.detailLab = [UILabel labelWithText:@"主题课程1级 第一课时" andTextColor:rgb(102,102,102) andName:nil andFontSize:12*kScaleFit];
    [self.contentView addSubview:self.detailLab];
    [self.detailLab makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15*kScaleFit);
        make.top.mas_equalTo(self.titleLab.mas_bottom).mas_equalTo(10*kScaleFit);
        make.right.mas_equalTo(-15*kScaleFit);
    }];
    
    self.bigIcon = [[UIImageView alloc] init];
    self.bigIcon.image = [UIImage imageNamed:@"wk_list_bgimg"];
    [self.contentView addSubview:self.bigIcon];
    [self.bigIcon makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15*kScaleFit);
        make.right.mas_equalTo(-15*kScaleFit);
        make.top.mas_equalTo(self.detailLab.mas_bottom).mas_equalTo(10*kScaleFit);
        make.height.mas_equalTo(190*kScaleFit);
    }];
    
    self.playIcon = [[UIImageView alloc] init];
    self.playIcon.image = [UIImage imageNamed:@"play"];
    self.playIcon.layer.cornerRadius = 27.5;
    self.playIcon.layer.masksToBounds = YES;
    
    [self.bigIcon addSubview:self.playIcon];
    [self.playIcon makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.bigIcon);
        make.centerX.mas_equalTo(self.bigIcon);
        make.size.mas_equalTo(CGSizeMake(30*kScaleFit, 30*kScaleFit));
    }];
    
    self.descLab = [UILabel labelWithText:@"Lucia家，不温不火的状态，从从容容地按自己的进度启蒙，我喜欢这样首先把自己的事做好，能有持久战斗力Lucia家，不温不火的状态，从从容容地按自己的进度启蒙，我喜欢这样首先把自己的事做好，能有持久战斗力Lucia家，不温不火的状态，从从容容地按自己的进度启蒙，我喜欢这样首先把自己的事做好，能有持久战斗力。" andTextColor:rgb(102,102,102) andName:nil andFontSize:14*kScaleFit];
    self.descLab.numberOfLines = 0;
    [self.contentView addSubview:self.descLab];
    [self.descLab makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15*kScaleFit);
        make.top.mas_equalTo(self.bigIcon.mas_bottom).mas_equalTo(10*kScaleFit);
        make.right.bottom.mas_equalTo(-15*kScaleFit);
    }];
    
    
}


@end
